<template>
  <div class="dashboard-editor-container">
    <!-- <div class="dashboard-text">name:{{ userInfo.nickname }}</div>
    <div class="dashboard-text">roles:{{ roles }}</div> -->
    <panel-group :list="panelGroupList"  />
     <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
      <line-chart :chartData="lineChartData" />
    </el-row>

  </div>
</template>

<script>
import { mapGetters } from "vuex";
import PanelGroup from "./admin/components/PanelGroup";
import LineChart from './admin/components/LineChart'
import { getDashboard } from '@/api/index'

export default {
  name: "Dashboard",
  components: {
    PanelGroup,
    LineChart
  },
  data() {
    return {
     panelGroupList: {},
     lineChartData:{}
    }
  },
  mounted() {
    this.getList()
  },
  computed: {
    ...mapGetters(["userInfo", "roles"]),
  },
  methods: {
    handleSetLineChartData(type) {
      console.log(type);
    },
    getList() {
      let vm = this
      getDashboard().then((response) => {
         vm.panelGroupList = response.data
         vm.lineChartData  = response.data.last_week_list
      })
    }
  },
};
</script>

<style  lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
